const {
  post,
  get
} = require("../../request/index");

const value="DD001"
// components/xd-scaner/xd-scaner.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
  },

  /**
   * 组件的方法列表
   */
  methods: {
    tapEvent: function () {
      var that = this;
      wx.scanCode({
        onlyFromCamera: true,
        success(res) {
          console.log(res.result);
          console.log(res.result.trim() === value);
          if (res.result.trim() === 'DD001') {
            wx.navigateTo({
              url: '/pages/scaner/index',
            })
          }
          return
          let prolist = wx.getStorageSync('prolist') == '' ? wx.getStorageSync('prolist') : JSON.parse(wx.getStorageSync('prolist'))
          let num = parseInt(prolist.userid)
          let url = `/app${res.result}/${num}%7D`
          get(url, {}).then(result => {
            console.log(result)
            if (result.msg == 'success') {
              wx.showToast({
                title: '登记成功',
                duration: 3000,
                mask: true
              })
            } else if (result.msg == '已签到') {
              wx.showToast({
                title: '您已签到',
                duration: 3000,
                mask: true
              })
            }
          })

        }
      })
    }






  }
})